package com.mgq.java8.lambda;

import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.IntConsumer;

/**
 * <b>功能：</b>Consumer<br>
 * <b>Copyright mgq</b>
 * <li>版本&nbsp;&nbsp;&nbsp;&nbsp;修改日期&nbsp;&nbsp;&nbsp;&nbsp;部　　门&nbsp;&nbsp;&nbsp;&nbsp;作　者&nbsp;&nbsp;&nbsp;&nbsp;变更内容</li><hr>
 * <li>v1.0&nbsp;&nbsp;&nbsp;&nbsp;20220412&nbsp;&nbsp;营业后台&nbsp;&nbsp;&nbsp;&nbsp;马广奇&nbsp;&nbsp;&nbsp;&nbsp;创建类</li>
 * <br><br>
 *
 * @author 马广奇
 * @version 2022-04-12 20:37
 */
public class ConsumerTest {
    public static void test() {
        Consumer<String> consumer= System.out::println;
        BiConsumer<String, Integer> biConsumer = (s, integer) -> System.out.println("字符串:" + s + ";数字:" + integer);
        //java8提供了针对原始类型的predicate,如IntConsumer,LongConsumer...,避免拆箱装箱性能损耗.
        IntConsumer intConsumer= System.out::println;
        consumer.accept("consumer");
        biConsumer.accept("hello world",2);
        intConsumer.accept(5555555);
    }

    public static void main(String[] args) {
        test();
    }
}
